package com.zbj.validator.service.impl;

import com.zbj.validator.common.Result;
import com.zbj.validator.entity.Student;
import com.zbj.validator.service.StudentService;
import com.zbj.validator.util.Constant;
import com.zbj.validator.util.ValidationUtil;
import org.springframework.stereotype.Service;

/**
 * StudentServiceImpl
 *
 * @author weigang
 * @create 2017-04-23
 **/
@Service
public class StudentServiceImpl implements StudentService {

	@Override
	public Result<Integer> insert(Student student) {
		Result<String> validate = ValidationUtil.validate((student));
		Result result = Result.create();
		if(!validate.isSuccess()){
			return result.fail(validate.getCode(), validate.getDescription());
		}

		result.success(Constant.ONE);
		return result;
	}
}
